/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package orgarqsindex.btree;

/**
 *
 * @author Fernando Molon Toigo e Dyoni Bertuol
 */
public class BTreeNodeKey {
    
    private long key;
    private long value;
    private BTreeNode node;
    private BTreeNode lowerNodes;
    private BTreeNode higherNodes;

    public BTreeNodeKey(long key, long value){
        this.key = key;
        this.value = value;
    }
    
    public void addLower(BTreeNodeKey lowerKey){
        if (this.getLowerNodes() == null)
            this.setLowerNodes(new BTreeNode(this.getNode()));

        this.getLowerNodes().addKey(lowerKey);
    }

    public void addHigher(BTreeNodeKey higherKey){
        if (this.getHigherNodes() == null)
            this.setHigherNodes(new BTreeNode(this.getNode()));

        this.getHigherNodes().addKey(higherKey);
    }

    @Override
    public String toString(){
        return String.valueOf(this.key);
    }

    public long getKey() {
        return this.key;
    }

    public BTreeNode getNode() {
        return node;
    }

    public void setNode(BTreeNode node) {
        this.node = node;
    }

    public BTreeNode getLowerNodes() {
        return lowerNodes;
    }

    public void setLowerNodes(BTreeNode lowerNodes) {
        this.lowerNodes = lowerNodes;
    }

    public BTreeNode getHigherNodes() {
        return higherNodes;
    }

    public void setHigherNodes(BTreeNode highersNodes) {
        this.higherNodes = highersNodes;
    }

    public long getValue() {
        return value;
    }
}
